<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width, user-scalable=no,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>Document</title>
    <style type="text/css">
        body {
            margin: 0px;
        }

        .con div {
            width: 23%;
            border: 2px solid #000000;
            background-color: gold;
            margin: 1%;
            height: 200px;
            float: left;
            box-sizing: border-box;
        }

        @media (max-width: 800px) {
            .con div {
                width: 46%;
                margin: 2%;
            }
        }

        @media (max-width: 400px) {
            .con div {
                width: 94%;
                margin: 3%;
            }
        }
    </style>
</head>

<body>
    <div class="con">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
    </div>

</body>

</html>